<cfcomponent displayname="snip" hint="I model a single snip.">

	<cfset variables.NumericNull = 0 />
	<cfset variables.StringNull = "" />
	<cfset variables.DateNull = now() />
	<cfset variables.BinaryNull = toBinary(toBase64("null")) />
		
	<cffunction name="init" access="public" returntype="snip" output="false" displayname="snip Constructor" hint="I initialize a snip.">
	<cfargument name="snipid" type="numeric" required="false" default="#variables.numericNull#"/>
	<cfargument name="name" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="useremail" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="parent" type="numeric" required="false" default="#variables.numericNull#"/>
	<cfargument name="help" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="description" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="starttext" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="endtext" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="author" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="platforms" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="template" type="string" required="false" default="#variables.stringNull#"/>
	<cfargument name="created" type="date" required="false" default="#variables.dateNull#"/>
	<cfargument name="updated" type="date" required="false" default="#variables.dateNull#"/>
	<cfargument name="published" type="numeric" required="false" default="#variables.numericNull#"/>
	<cfargument name="ownerid" type="string" required="false" default="#variables.stringNull#"/>
	

		<cfscript>
			variables.instanceData = structnew();
			
			setsnipid(arguments.snipid);
			setname(arguments.name);
			setuseremail(arguments.useremail);
			setparent(arguments.parent);
			sethelp(arguments.help);
			setdescription(arguments.description);
			setstarttext(arguments.starttext);
			setendtext(arguments.endtext);
			setauthor(arguments.author);
			setplatforms(arguments.platforms);
			settemplate(arguments.template);
			setcreated(arguments.created);
			setupdated(arguments.updated);
			setpublished(arguments.published);
			setownerid(arguments.ownerid);
		</cfscript>

		<cfreturn this />
	</cffunction>

	<cffunction name="setInstanceData" access="public" output="false" returntype="void">
		<cfargument name="data" type="struct" required="true"/>
		<cfset variables.instanceData = arguments.data/>
	</cffunction>

	<cffunction name="getInstanceData" access="public" output="false" returntype="struct">

		<cfreturn variables.instanceData/>
	</cffunction>
	
	<cffunction name="hasId" access="public" output="false" returntype="boolean" hint="I retrieve whether the snip has an id (false indicates it's a new user)">

		<cfreturn structKeyExists(variables.instanceData,"snipID")/>
	</cffunction>
	
	<cffunction name="getsnipid" access="public" returntype="numeric" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.snipid />
	</cffunction>	

	<cffunction name="setsnipid" access="public" returntype="void" output="false">
		<cfargument name="snipid" type="numeric" required="true">
		<cfset variables.instanceData.snipid=arguments.snipid />
	</cffunction>
	
	<cffunction name="getname" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.name />
	</cffunction>	

	<cffunction name="setname" access="public" returntype="void" output="false">
		<cfargument name="name" type="string" required="true">
		<cfset variables.instanceData.name=arguments.name />
	</cffunction>
	
	<cffunction name="getuseremail" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.useremail />
	</cffunction>	

	<cffunction name="setuseremail" access="public" returntype="void" output="false">
		<cfargument name="useremail" type="string" required="true">
		<cfset variables.instanceData.useremail=arguments.useremail />
	</cffunction>
	
	<cffunction name="getparent" access="public" returntype="numeric" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.parent />
	</cffunction>	

	<cffunction name="setparent" access="public" returntype="void" output="false">
		<cfargument name="parent" type="numeric" required="true">
		<cfset variables.instanceData.parent=arguments.parent />
	</cffunction>
	
	<cffunction name="gethelp" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.help />
	</cffunction>	

	<cffunction name="sethelp" access="public" returntype="void" output="false">
		<cfargument name="help" type="string" required="true">
		<cfset variables.instanceData.help=arguments.help />
	</cffunction>
	
	<cffunction name="getdescription" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.description />
	</cffunction>	

	<cffunction name="setdescription" access="public" returntype="void" output="false">
		<cfargument name="description" type="string" required="true">
		<cfset variables.instanceData.description=arguments.description />
	</cffunction>
	
	<cffunction name="getstarttext" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.starttext />
	</cffunction>	

	<cffunction name="setstarttext" access="public" returntype="void" output="false">
		<cfargument name="starttext" type="string" required="true">
		<cfset variables.instanceData.starttext=arguments.starttext />
	</cffunction>
	
	<cffunction name="getendtext" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.endtext />
	</cffunction>	

	<cffunction name="setendtext" access="public" returntype="void" output="false">
		<cfargument name="endtext" type="string" required="true">
		<cfset variables.instanceData.endtext=arguments.endtext />
	</cffunction>
	
	<cffunction name="getauthor" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.author />
	</cffunction>	

	<cffunction name="setauthor" access="public" returntype="void" output="false">
		<cfargument name="author" type="string" required="true">
		<cfset variables.instanceData.author=arguments.author />
	</cffunction>
	
	<cffunction name="getplatforms" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.platforms />
	</cffunction>	

	<cffunction name="setplatforms" access="public" returntype="void" output="false">
		<cfargument name="platforms" type="string" required="true">
		<cfset variables.instanceData.platforms=arguments.platforms />
	</cffunction>
	
	<cffunction name="gettemplate" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.template />
	</cffunction>	

	<cffunction name="settemplate" access="public" returntype="void" output="false">
		<cfargument name="template" type="string" required="true">
		<cfset variables.instanceData.template=arguments.template />
	</cffunction>
	
	<cffunction name="getcreated" access="public" returntype="date" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.created />
	</cffunction>	

	<cffunction name="setcreated" access="public" returntype="void" output="false">
		<cfargument name="created" type="date" required="true">
		<cfset variables.instanceData.created=arguments.created />
	</cffunction>
	
	<cffunction name="getupdated" access="public" returntype="date" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.updated />
	</cffunction>	

	<cffunction name="setupdated" access="public" returntype="void" output="false">
		<cfargument name="updated" type="date" required="true">
		<cfset variables.instanceData.updated=arguments.updated />
	</cffunction>
	
	<cffunction name="getpublished" access="public" returntype="numeric" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.published />
	</cffunction>	

	<cffunction name="setpublished" access="public" returntype="void" output="false">
		<cfargument name="published" type="numeric" required="true">
		<cfset variables.instanceData.published=arguments.published />
	</cffunction>
	
	<cffunction name="getownerid" access="public" returntype="string" output="false" displayname="" hint="">
		
		<cfreturn variables.instanceData.ownerid />
	</cffunction>	

	<cffunction name="setownerid" access="public" returntype="void" output="false">
		<cfargument name="ownerid" type="string" required="true">
		<cfset variables.instanceData.ownerid=arguments.ownerid />
	</cffunction>
	
</cfcomponent>
	

